package com.atguigu.eduservice.client;

import com.atguigu.commonutils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

//微服务模块service-edu调用另一个模块service-vod
//使用Netflix中的Feign来调用删除阿里云视频
@Component
//调用微服务的名称,当调用服务宕机的时候，实现类就是VodClientHystrixImpl
@FeignClient(name = "service-vod",fallback = VodClientHystrixImpl.class)
public interface VodClient {//VODClient是一个借口，实现该接口就是调用模块中的方法

    //根据视频id删除视频
    //@PathVariable该注解中的一定要指明参数名称，否则出错
    @DeleteMapping("/eduvod/video/removeVideo/{videoId}")
    Result removeVideo(@PathVariable(value = "videoId") String videoId);

    @DeleteMapping("/eduvod/video/removeAllVideo")
    Result removeAllVideo(@RequestParam("videoIdList") List<String> videoIdList);
}
